#!/usr/bin/python
# -*- coding: utf-8 -*-

import os
import ConfigParser

DIR_USER = os.environ['HOME'] + '/.feedbar'

def getfeeds():
    feeds = {}
    config = ConfigParser.RawConfigParser()
    config.read(DIR_USER + '/feeds.cfg')
    for x in config.sections():
        if config.get(x, 'feed_type') == 'Feed':
            localdict = {}
            localdict['feed_type'] = config.get(x, 'feed_type')
            localdict['feed_title'] = config.get(x, 'feed_title')
            localdict['feed_link'] = config.get(x, 'feed_link')
            localdict['feedmax'] = config.getint(x, 'feedmax')
            localdict['RtL'] = config.getboolean(x, 'RtL')
            localdict['pango'] = config.getboolean(x, 'pango')
            
            feeds[int(x)] = localdict
    return feeds
